/* 
 * File:   FileHeader.h
 * Author: Luis
 *
 * Created on 14 de abril de 2013, 16:22
 */

#ifndef FILEHEADER_H
#define	FILEHEADER_H



#endif	/* FILEHEADER_H */

struct FileHeader
{    
    FileHeader();
    FileHeader(char* fileName);
    FileHeader(const FileHeader& other);
    FileHeader& operator=(const FileHeader& other);
    ~FileHeader();
    bool operator==(const FileHeader& other);
    char* buildFileHeader();
    
    void setVersionToExtract(const short versionToExtract);
    void setFlag(const short flag);
    void setCompressionMethod(const short compressionMethod);
    void setLastModificationTime(const short lastModificationTime);
    void setLastModificationDate(const short lastModificationDate);
    void setCrc(const int crc);
    void setCompressedSize(const int compressedSize);
    void setUnCompressedSize(const int unCompressedSize);
    void setExtraFieldLength(const short extraFieldLength);
    void setFileName(char* fileName);
    void setExtraField(const char* extraField);
    void setAbsolutePath(const char* absolutePath);
    void setFileData(const char* fileData, size_t fileDataLength);
    
    size_t getBufferSize();
    size_t getFileDataLength();
    
    char* getBuffer();
    char* getFileName();
    char* getExtraField();
    char* getAbsolutePath();
    char* getFileData();
    
    short getVersionToExtract();
    short getFlag();
    short getCompressionMethod();
    short getLastModificationTime();
    short getLastModificationDate();
    short getFileNameLength();
    short getExtraFieldLentgth();
    
    int getCrc();
    int getCompressedSize();
    int getUncompressedSize();
    
    const int fileHeader_;
    
private:
    void initialize(const char* fileName, const char* absolutePath,const char* buffer,
        size_t bufferLength, const char* extraField, size_t extraFieldLength, const char* fileData,
        size_t fileDataLength);
    
    short versionToExtract_;
    short flag_;
    short compressionMethod_;
    short lastModificationTime_;
    short lastModificationDate_;
    short fileNameLength_;
    short extraFieldLength_;
    
    int crc_;
    int compressedSize_;
    int unCompressedSize_;
    
    char* fileName_;
    char* extraField_;
    char* absolutePath_;
    char* fileData_;
    char* buffer_;
    
    size_t bufferSize_;
    size_t fileDataLength_;
};
